import java.util.Arrays;

public class Finding2NumSum {
    public static int[] fin(int[] nums,int target){
        int[] ret = new int[2];
        for (int i = 0; i < nums.length-1; i++) {
            for (int j = 0+i; j <nums.length ; j++) {
                if(nums[i]+nums[j]==target) {
                    ret[0]=i;
                    ret[1]=j;
                    return ret;
                }
            }
        }
        int[] no={-1};
        return no;
    }

    public static void main(String[] args) {
        int[] nums={7,11,6,8,2};
        int target = 9;
        System.out.println(Arrays.toString(fin(nums, target)));
    }
}
